package com.lmpop.trade.ti_createlog;

import com.lmpop.frame.QueryList;
import com.lmpop.frame.SysMap;
import com.lmpop.frame.TradeInterf;
import com.lmpop.frame.dao.DbmInterf;
import com.lmpop.frame.exp.ApplicationException;
import java.util.Hashtable;
import java.util.List;

public class Ti_createlogInfo
  implements TradeInterf
{
  QueryList queryList;

  public Ti_createlogInfo()
  {
    this.queryList = new QueryList();
  }

  public SysMap insert(DbmInterf dbmMgr, SysMap map)
  {
    Ti_createlog ti_createlog = new Ti_createlog();
    String info_id = "";
    if ((map.getString("info_id") != null) && (!map.getString("info_id").equals(""))) info_id = map.getString("info_id");
    if ((map.getString("biz_id") != null) && (!map.getString("biz_id").equals(""))) info_id = map.getString("biz_id");
    if ((map.getString("news_id") != null) && (!map.getString("news_id").equals(""))) info_id = map.getString("news_id");
    if ((map.getString("zhuanti_id") != null) && (!map.getString("zhuanti_id").equals(""))) info_id = map.getString("zhuanti_id");
    if ((map.getString("goods_id") != null) && (!map.getString("goods_id").equals(""))) info_id = map.getString("goods_id");
    if ((map.getString("credit_id") != null) && (!map.getString("credit_id").equals(""))) info_id = map.getString("credit_id");
    if ((map.getString("job_id") != null) && (!map.getString("job_id").equals(""))) info_id = map.getString("job_id");
    if ((map.getString("resume_id") != null) && (!map.getString("resume_id").equals(""))) info_id = map.getString("resume_id");

    if ((map.getString("price_id") != null) && (!map.getString("price_id").equals(""))) info_id = map.getString("price_id");
    if ((map.getString("house_id") != null) && (!map.getString("house_id").equals(""))) info_id = map.getString("house_id");
    if ((map.getString("src_id") != null) && (!map.getString("src_id").equals(""))) info_id = map.getString("src_id");

    if ((map.getString("bid_id") != null) && (!map.getString("bid_id").equals(""))) info_id = map.getString("bid_id");
    if ((map.getString("trade_id") != null) && (!map.getString("trade_id").equals(""))) info_id = map.getString("trade_id");
    if ((map.getString("show_id") != null) && (!map.getString("show_id").equals(""))) info_id = map.getString("show_id");
    if ((map.getString("product_id") != null) && (!map.getString("product_id").equals(""))) info_id = map.getString("product_id");

    ti_createlog.setInfo_id(info_id);

    String result_code = "0";
    try {
      insert(dbmMgr, ti_createlog);
    } catch (ApplicationException e) {
      e.printStackTrace();
      result_code = "1";
    }
    map.setString("result_code", result_code);
    return map;
  }

  public void insert(DbmInterf dbmMgr, Ti_createlog ti_createlog)
    throws ApplicationException
  {
    dbmMgr.update("insertTi_createlog", ti_createlog);
  }

  public SysMap delete(DbmInterf dbmMgr, SysMap map)
  {
    String result_code = "0";
    try
    {
      delete(dbmMgr, map.getString("info_id"));
    } catch (ApplicationException e) {
      e.printStackTrace();
      result_code = "1";
    }
    map.setString("result_code", result_code);
    return map;
  }

  public void delete(DbmInterf dbmMgr, String pkid)
    throws ApplicationException
  {
    dbmMgr.update("deleteTi_createlog", pkid);
  }

  public void deleteone(String pkid) throws ApplicationException {
    DbmInterf dbmMgr = null;
    dbmMgr.update("deleteTi_createlog", pkid);
    dbmMgr.commit();
  }

  public List getListByPk(String pk) {
    return this.queryList.getList("getTi_createlogByPk", pk);
  }

  public List getListByAll() {
    return this.queryList.getList("getTi_createlogByAll", "");
  }
  public int getCountByObj(Object obj) {
    Hashtable params = (Hashtable)obj;
    List list = this.queryList.getList("", params);
    int count = 0;
    if (list != null)
    {
      count = list.size();
    }
    return count;
  }

  public List getListByPage(Object obj, int start, int limit) {
    Hashtable params = (Hashtable)obj;
    if (start == 0)
      start = 0;
    else {
      start = (start - 1) * limit;
    }
    params.put("start", Integer.valueOf(start));
    params.put("limit", Integer.valueOf(limit));
    return this.queryList.getList("", params);
  }
  public void update(DbmInterf dbmMgr, Ti_createlog ti_createlog) throws ApplicationException {
    dbmMgr.update("", ti_createlog);
  }
  public SysMap update(DbmInterf dbmMgr, SysMap map) { return map;
  }
}